package com.papper.common.enums;

/**
 * @Author:Lajiao
 * @Date:2014年7月14日
 * @Time:下午3:49:44
 * @Description:分润类型
 */
public enum ProfitTypeEnum {
    T0("T0", "快捷收款"),
    T1("T1", "普通收款"),
    S0("S0", "系统维护费"),
    S1("S1", "提现费"),
    ORDER("O", "订单分润"),
    SETTLE("S", "结算分润"),
    CHARGE("C", "提现分润"),
    CARDAUTH("JQ", "鉴权分润"),
    CERTAUTH("SM", "实名分润"),
    REWARD("HD", "活动奖励"),
    VIP("VIP", "会员分润"),
    ORG("ORG", "代理商升级"),
    PREPAY("PRE", "预消费分润");

    private String code;
    private String name;

    ProfitTypeEnum(String code, String name) {
        this.code = code;
        this.name = name;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public static String getName(String code) {
        if (code == null) {
            return "";
        }
        for (ProfitTypeEnum re : ProfitTypeEnum.values()) {
            if (re.getCode().equals(code)) {
                return re.getName();
            }
        }
        return "";
    }

    public static String getCode(String name) {
        if (name == null) {
            return null;
        }
        for (ProfitTypeEnum re : ProfitTypeEnum.values()) {
            if (name.equals(re.getName())) {
                return re.getCode();
            }
        }
        return null;
    }
}
